/*
 * @(#)CheckHangulMethod.java $version 2010. 8. 11
 *
 * Copyright 2007-2010 NHN Corp. All rights Reserved. 
 * NHN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.nhncorp.usf.macro.method.component;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import freemarker.template.TemplateMethodModel;
import freemarker.template.TemplateModelException;

/**
 * @author Web Platform Development Team
 */
public class CheckHangulMethod implements TemplateMethodModel {
    Log log = LogFactory.getLog(CheckHangulMethod.class);

    /**
     * @param args the arguments
     * @return the unicode value
     * @throws TemplateModelException the TemplateModelException
     */
    @SuppressWarnings("unchecked")
	public Object exec(List args) throws TemplateModelException {

        if (args.size() != 1) {
            throw new IllegalArgumentException();
        }

        String str = (String)args.get(0);

        if (log.isDebugEnabled()) {
            log.debug("arg string : " + str);
        }

        char value = str.charAt(0);

        return value >= '\uAC00' && value <= '\uD7A3';
    }
}
